import { _decorator, Component, Node } from 'cc';
import { Subpages } from './Subpages';
const { ccclass, property } = _decorator;

@ccclass('PageCore')
export abstract class PageCore extends Component {

    public getID():string
    {
        console.log("页面ID并未重写!")
        return "Empty"
    }

    public init(data:{}):void
    {
        console.log("页面初始化并未重写!")
    }

    public openPage():void{
        this.node.active = true
    }

    public closePage():void{
        this.node.active = false
    }

    public getSubpages(subpages:Subpages,subpageRoot:Node):void
    {
        for(let i = 0;i<subpageRoot.children.length;i++)
        {
            let selection = subpageRoot.children[i];
            subpages.addPage(selection.name,selection);
        }
    }
}

